using System;
using System.Collections.Generic;
using System.Text;
using Koda.VisualStudio.Integration;
using Koda.VisualStudio;
using EnvDTE80;
using Koda.UI;
using Koda.Utils;
using Koda.Model;

namespace Koda.Commands
{
    public class GeneratePropertiesCommand : VsCommand
    {
        public GeneratePropertiesCommand()
            : base("Generate Properties ...", "Code Window", 1)
        {
                
        }

        public override bool OnQueryStatus(VsCommandEventArgs e)
        {
            if (VsCodeModelUtilities.GetClassFromSelection(e.DTE) != null)
                return true;
            return false;
        }

        public override void OnExecute(VsCommandEventArgs e)
        {
            CodeClass2 codeClass = VsCodeModelUtilities.GetClassFromSelection(e.DTE);
            if (codeClass != null)
            {
                PropertyGenerator propertyGenerator = new PropertyGenerator(codeClass);
                GeneratePropertiesForm form = new GeneratePropertiesForm(propertyGenerator);
                form.ShowDialog();
            }
        }

    }
}
